class cutPage {
    constructor(option) {
        let { el, data, pageLength, cb1, cb2 } = option
        this.el = el
        this.data = data
        this.pageLength = pageLength
        this.cb1 = cb1
        this.cb2 = cb2
        this.page()
        this.init()
    }
    init() {
        this.el.onclick = (e) => {
            if (e.target.nodeName === 'SELECT') {
                this.page(this.el.children[0].value)
            }
            if (e.target.nodeName === 'LI') {
                this.list(e.target.innerHTML)
            }
        }
    }
    page(num) {
        let pagenum = Math.ceil(this.data.length / num);
        console.log(pagenum)
        this.pagelist(pagenum, 0)
    }
    pagelist(pagenum, statr) {
        let listnum = Math.ceil(this.data.length / pagenum)
        let loddata = this.data
        let newdata = loddata.slice(statr, listnum)
        this.cb1({ pagenum, newdata })
    }
    list(num) {
        this.cb1({ num })
    }
}